﻿using ML.Entity;

namespace ML.IBusiness
{
    /// <summary>
    /// 用户业务接口
    /// </summary>
    public interface IUserBusiness
    {
        /// <summary>
        /// 根据查询条件查询用户信息
        /// </summary>
        /// <param name="userSearch">用户查询条件</param>
        /// <returns></returns>
        BaseResult<Pager<UserEntity>> List(UserSearch userSearch);

        /// <summary>
        /// 根据用户Id查询用户信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        BaseResult<UserEntity> GetById(string id);

        /// <summary>
        /// 根据用户Id查询用户信息（微信小程序）
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        BaseResult<WXuserLogin> WXgetById(string id);

        /// <summary>
        /// 根据主键Id查询可用的用户信息(密码不返回)
        /// </summary>
        /// <param name="id">用户Id</param>
        /// <returns></returns>
        BaseResult<UserEntity> GetByUserId(string openid);

        /// <summary>
        /// 根据openId查询可用的用户信息(密码不返回)
        /// </summary>
        /// <param name="id">用户的openid</param>
        /// <returns></returns>
        BaseResult<UserEntity> GetByOpenId(string id);

        /// <summary>
        /// 管理员登陆
        /// </summary>
        /// <param name="login_name_in">用户名</param>
        /// <param name="user_pwd_in">密码</param>
        /// <returns></returns>
        BaseResult<bool> Login(string login_name_in, string user_pwd_in);

        /// <summary>
        /// 骑手登录api接口
        /// </summary>
        /// <param name="nickname">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        BaseResult<bool> HorsemanLogin(string nickname, string password);

        /// <summary>
        /// 商户登录api接口
        /// </summary>
        /// <param name="nickname">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        BaseResult<bool> MerchantLogin(string nickname, string password);

        /// <summary>
        /// 商户登录api接口（微信小程序）
        /// </summary>
        /// <param name="nickname">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        BaseResult<WXuserLogin> WXmerchantLogin(string nickname, string password);

        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="userEntity">实体</param>
        /// <returns></returns>
        BaseResult<bool> Add(UserEntity userEntity);

        /// <summary>
        /// 微信授权登录添加用户
        /// </summary>
        /// <param name="userEntity"></param>
        /// <returns></returns>
        BaseResult<UserEntity> AddWXUser(UserEntity userEntity);

        /// <summary>
        /// 根据更新用户信息
        /// </summary>
        /// <param name="userEntity">用户实体信息</param>
        /// <returns></returns>
        BaseResult<bool> UpdateUser(UserEntity userEntity);

        /// <summary>
        /// 用户修改密码
        /// </summary>
        ///  <param name="password_old">用户Id</param>
        /// <param name="password_new">新密码</param>
        /// <returns></returns>
        BaseResult<bool> UpdatePassword(string id, string password_new);

        /// <summary>
        /// 修改用户分类
        /// </summary>
        /// <param name="id">用户Id</param>
        /// <param name="user_type">用户分类</param>
        /// <returns></returns>
        BaseResult<bool> UpdateUserType(string id, int user_type);

        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns></returns>
        BaseResult<bool> Delete(string id);

        /// <summary>
        /// 根据邀请code获取用户信息
        /// </summary>
        /// <param name="invitationcode">邀请code</param>
        /// <returns></returns>
        BaseResult<UserEntity> GetByInvitationCode(string invitationcode);
    }
}